import os
import sys

from xhtml2pdf import pisa

platform = 'win' if sys.platform == 'win32' else 'linux'

base = os.path.abspath(os.path.dirname(__file__))

file = open('xhtml_python-{}.pdf'.format(platform), 'wb')

with open(os.path.join(base, '..', 'index.html'), 'r', encoding='utf-8') as fd:
    content = fd.read()

pisa.CreatePDF(content, dest=file)

file.close()
